﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>在script标签中调用</title>
</head>
<body>
    <p>点击按钮执行<em>displayDate()</em>函数，显示当前时间信息</p>
    <button id="myBtn">显示时间</button>
    <script>
        document.getElementById("myBtn").onclick = function () {
            displayDate()
        };
        function displayDate() {
            document.getElementById("demo").innerHTML = Date();
        }
    </script>
</body>
</html>